package figuriConcrete;
import java.util.*;

import figuriAbstracte.*;

public class Triangle extends PointPoligon{
	private ArrayList<Point> points;
	
	public void createPoints()
	{
		this.points=new ArrayList<Point>(3);
	}
	public ArrayList<Point> getPoints()
	{
		return this.points;
	}
	public void setPoints(ArrayList<Point> p)
	{
		this.points=p;
	}
	public double perimeter()
	{
		double a=this.points.get(0).distance(this.points.get(1));
		double b=this.points.get(1).distance(this.points.get(2));
		double c=this.points.get(2).distance(this.points.get(0));
		double perimeter=a+b+c;
		return perimeter;
		
	}
	public double getLength()
	{
		return this.perimeter();
	}
	public double getArea()
    {
    	double perimeter=this.perimeter()/2;
    	double a=this.points.get(0).distance(this.points.get(1));
    	double b=this.points.get(1).distance(this.points.get(2));
    	double c=this.points.get(2).distance(this.points.get(0));
    	return Math.sqrt(perimeter*(perimeter-a)*(perimeter-b)*(perimeter-c));
    }
	 public String toString()
	    {
	    	return "Laturile triungiului sunt formate din" +
	    			"punctele: "+points.get(0)+" "+points.get(1)+" "+points.get(2);
	    }


}
